////////////////////////////////////////
// StringTableTester.cpp
// Name:  Stephen Durfey
// Class: CS335
// Time:  Tue, Thurs 1:00-2:15pm
// Professor: Dr. Michael Poor
// Description: This program employs the use of a 2d vector stored in the private
//              section of the class "StringTable". Each row in the 2d vector
//              will contain a row from the file specified by the user
//              at the command line prompt. Once the 2d vector
//              has been created, it will be traversed by a for loop, looking
//              for and printing out specified information for all matches of
//              the city "Rome". 

#include <iostream>
#include <fstream>
#include "StringTable.h"
using namespace std;

int main(int argc, char *argv[])
{
    ifstream inFile(argv[1]);
    string fullWord;
    int row;
    
    if(!inFile) //if file fails to open, quit
        return 0;
    
    //calls the constructor to create the entire 2d vector
    StringTable cityTable(inFile, fullWord);
    
    //loops until the entire 2d vector has been traversed. printing out
    //only the matches for "Rome".
    for(row = 0; row < cityTable.rows(); row++)
    {
        if(cityTable[row][0] == "Rome")
        {
            cout << cityTable[row][0] << " " << cityTable[row][3] << " " << cityTable[row][4] << endl;
        }
    }
    
    return 0;
}

